#-------------------------------------------------------------------------------
# Copyright (c) 2012 Huseyin BIYIK.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the GNU Public License v3.0
# which accompanies this distribution, and is available at
# http://www.gnu.org/licenses/gpl.html
# 
# Contributors:
#     Huseyin BIYIK - initial API and implementation
#-------------------------------------------------------------------------------
import sys
from crowd.api import *
from crowd.defs import *

if __name__ == '__main__':
	laddr = sys.argv[1]
	lport = int(sys.argv[2])
	raddr = sys.argv[3]
	rport = int(sys.argv[4])
	isloop = int(sys.argv[5])

	cr_api = crowd(laddr, int(lport), isloop)
	try:
		if isloop:
			logger.info("Audioserver is looping back incoming audio")
		else:
			logger.info("Audioserver is calling %s:%d from %s:%d", raddr, rport, laddr, lport)
			cr_api.make_call(raddr, rport, "audio")
		while True:
			continue
	except KeyboardInterrupt:
		cr_api.close()
